package com.appengine.news.entity;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Text;

/**
 * RSS Feed entity
 * 
 * @author Aliaksandr_Spichakou
 * 
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class RssFeedEntity {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private String url;
	@Persistent
	private Text title;
	@Persistent
	private Date lastUpdate;
	@Persistent
	private Text subtitle;
	@Persistent
	private Long updateFreq;

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof RssFeedEntity)
		{
			final RssFeedEntity other = (RssFeedEntity)obj;
			final Long id2 = other.getId();
			if((id2!=null) && (id!=null) && id2.equals(id))
			{
				return true;
			}
		}
		return false;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Text getTitle() {
		return title;
	}

	public void setTitle(Text title) {
		this.title = title;
	}

	public Date getLastUpdate() {
		return lastUpdate;
	}

	public void setLastUpdate(Date lastUpdate) {
		this.lastUpdate = lastUpdate;
	}

	public Text getSubtitle() {
		return subtitle;
	}

	public void setSubtitle(Text subtitle) {
		this.subtitle = subtitle;
	}

	public Long getUpdateFreq() {
		return updateFreq;
	}

	public void setUpdateFreq(Long updateFreq) {
		this.updateFreq = updateFreq;
	}

}
